package com.itheima.service;

import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import com.itheima.dao.CustomerDao;
import com.itheima.domain.Customer;
@Transactional
public class CustomerService {

	private CustomerDao dao;
	
	
	public void setDao(CustomerDao dao) {
		this.dao = dao;
	}


	public void saveAdd(Customer customer) {
		dao.saveAdd(customer);
	}


	public List<Customer> list() {
		return dao.list();
	}


	public void delete(Customer customer) {
		//先查询
		Customer c = dao.findOne(customer);
		//再删除
		dao.delete(c);
	}


	public Customer find(Customer customer) {
		customer = dao.find(customer);
		return customer;
	}


	public void saveEdit(Customer customer) {
		dao.saveEdit(customer);
	}


	public List<Customer> likeSerch(Customer customer) {
		return dao.likeSerch(customer);
	}

}
